package com.atguigu.gmall.all.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * 测试Thymeleaf
 * 页面标签
 * 转发页面
 */
@Controller
public class TestThymeleafController {



    @GetMapping("/thymeleaf/test")
    public String testThymeleaf( Model model){
        model.addAttribute("hello","大家好才是真的好");
        //request.setAttribute(k,v)

        List<String> persons = new ArrayList<>();
        persons.add("简梦华");
        persons.add("刘德华");
        model.addAttribute("persons",persons);
        return "test"; //默认为.html
    }

}
